import { Component, OnInit, Input } from '@angular/core';

import { BlogService } from '../../blog.service';

@Component({
  selector: 'app-commit-content',
  templateUrl: './commit-content.component.html',
  styleUrls: ['./commit-content.component.scss']
})
export class CommitContentComponent implements OnInit {
  @Input() commit: any;
  name: string;
  date: string;
  message: string;

  constructor(
    private blogService: BlogService
  ) { }

  ngOnInit() {
    this.name = this.commit.commit.commiter.name;
    this.date = this.commit.commit.commiter.date;
    this.blogService.markedContent(this.commit.commit.message)
      .subscribe(mdContent => this.message = mdContent);
  }

}
